import { InputQuestion, QuestionBase, SelectQuestion } from '@/components/public-template';
import { Api } from '@/config/api/authorityManage';
import { regExp } from '@/utils/regExp';

class IndexService {
  getQuestions({ showType }) {
    const questions: QuestionBase<any>[] = [
      new SelectQuestion({
        key: 'code',
        label: '档案权限编码',
        required: true,
        type: 'slot',
        state: {
          slotName: 'generateCode'
        }
      }),
      new InputQuestion({
        key: 'name',
        label: '档案权限名称',
        required: true,
        reg: regExp.len50,
        prompt: '档案权限名称不能为空，长度在50个字符之内'
      }),
      new SelectQuestion({
        key: 'toDepartment',
        label: '角色',
        required: true,
        prompt: '请选择',
        type: 'search',
        state: {
          mode: 'multiple',
          url: Api.roleList,
          protType: 'post',
          nameKey: 'name',
          nameValue: 'id'
          // nameChildren: 'childOrg'
        }
      }),
      new InputQuestion({
        key: 'remark',
        label: '备注',
        reg: regExp.len200,
        prompt: '长度在200个字符之内'
      })
      // new InputQuestion({
      //   key: 'securityLevel',
      //   label: '档案类型权限',
      //   type: 'slot',
      //   state: {
      //     grid: 24,
      //     slotName: 'archivesAuthorityType'
      //   }
      // })
    ];
    return questions;
  }
}

export default new IndexService();
